package com.sr.vo.req;

import com.sr.pojo.WSign;
import com.sr.util.ToolUtil;
import com.sr.vo.BaseForm;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.Date;

/**
 * @author xiaochi
 * @date 2022/5/1 11:09
 * @desc SignReqVo
 */
@Data
@ApiModel("签到实体")
@EqualsAndHashCode(callSuper = true)
public class SignReqVo extends BaseForm<WSign> {

    @ApiModelProperty("签到内容不能超过255个字符")
    @NotBlank(message = "签到内容不能为空")
    @Size(max = 255,message = "签到内容不能超过255字符")
    private String signContent;

    /**
     * 获取实例
     * @return 返回实体类
     */
    @Override
    public WSign buildEntity() {
        WSign wSign = new WSign();
        BeanUtils.copyProperties(this,wSign);
        wSign.setId(ToolUtil.nextId());
        wSign.setIsDel(0);
        wSign.setCreateTime(new Date());
        return wSign;
    }
}
